/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.oimwrapper.testers;

import com.thortech.util.logging.Logger;
import org.junit.Test;
import org.oimwrapper.connectors.OIMTaskBase;

/**
 *
 */
public class ClientTaskBaseTester {
            
    String[] oimTools = {"org.oimwrapper.scheduledtasks.OIMTools",
                         "/netbeans9102/BofAOIMAPI/test/connection.properties",
                         "/netbeans9102/BofAOIMAPI/test/loadlookup.properties",
                         "bypass"};
    
    String[] taskArgs = {"org.oimwrapper.scheduledtasks.LoadLookupFromDb",
                         "/netbeans9102/BofAOIMAPI/test/connection.properties",
                         "/netbeans9102/BofAOIMAPI/test/loadlookupdb.properties",
                         "bypass"};
    private static final Logger logger = Logger.getLogger(ClientTaskBaseTester.class.getName());
    
    @Test
    public void mainTest() {
        try {
            String className = taskArgs[0];
            String[] remainingArgs = new String[taskArgs.length - 1];
            for (int i = 0; i < remainingArgs.length; i++) {
                remainingArgs[i] = taskArgs[i + 1];
            }
            logger.debug("Calling Task:" + className);
            OIMTaskBase task = (OIMTaskBase) Class.forName(className).newInstance();
            OIMTaskBase.main(remainingArgs, task);
        } catch (Exception e) {
            logger.error("ERROR",e);
        }
    }
    
    
}
